package com.leadingsoft.common.kettle.environment;

import org.springframework.beans.factory.InitializingBean;

import com.leadingsoft.common.kettle.repository.RepositoryUtil;
import com.leadingsoft.web.service.ThreadPoolService;

public class StartInit implements InitializingBean{
    
    private ThreadPoolService threadPoolService;

	@Override
	public void afterPropertiesSet() throws Exception {
		//初始化环境***
		com.leadingsoft.common.kettle.environment.KettleInit.init();
		org.pentaho.di.core.KettleEnvironment.init();
		
		Runtime.getRuntime().addShutdownHook(new Thread() {

            @Override
            public void run() {
                threadPoolService.shutdownThreadPool();
                RepositoryUtil.disConnectionAllRepository();
            }

        });
	}

}
